package cn.sdhuijin.dao;

import java.util.Collection;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;

import cn.sdhuijin.model.User;

public interface UserDao extends JpaRepository<User, Long> {

	public Page<User> findAll(Specification<User> spec, Pageable pageable);

	public List<User> findByBranchIdAndName(Long branchId, String name);

	public List<User> findByBranchIdAndTelphone(Long branchId, String telphone);

	public Page<User> findByNameLikeAndUserTypeLike(String userName,
			String userType, Pageable pageable);

	public Page<User> findByNameLikeAndUserTypeLikeAndBranchIdIn(
			String userName, String userType, Collection<Long> branchIds,
			Pageable pageable);

	public List<User> findByTelphoneAndPassword(String telphone, String password);

	public List<User> findByTelphone(String telphone);

	public List<User> findByBranchIdInAndUserTypeLike(
			Collection<Long> branchIds, String userType);

	public List<User> findByNameLikeAndUserTypeLikeAndBranchIdIn(
			String userName, String userType, Collection<Long> branchIds);

	public List<User> findByNameLikeAndUserTypeLike(String userName,
			String userType);
}
